package com.woniuxy.service.Impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.woniuxy.dao.ExamineDao;
import com.woniuxy.dao.LoanUserDao;
import com.woniuxy.dao.ProCreditDao;
import com.woniuxy.entity.LoanUserInfo;
import com.woniuxy.entity.ProCredit;
import com.woniuxy.service.ProCreditService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description: 具体业务代码
 * @author quanquan
 * @date 2022/9/21 19:12
 * @version 1.0
 */
@Service
@MapperScan("com.woniuxy.dao")
public class ProCreditServiceImpl implements ProCreditService {
    @Autowired
    ProCreditDao proCreditDao;
    @Autowired
    LoanUserDao loanUserDao;
    @Autowired
    ExamineDao examineDao;

    @Override
    public List<ProCredit> findlistProCreditAll() {
        int userId= Math.toIntExact(SecurityUtils.getUserId());
        List<ProCredit> allList = proCreditDao.findlistProCreditAll(userId);
        LoanUserInfo loanUser= loanUserDao.findLoanUser(userId);
        for(ProCredit proCredit:allList){
            proCredit.setUserName(loanUser.getUserName());
            proCredit.setUserPhone1(loanUser.getUserPhone1());
            proCredit.setUserId(userId);
            System.out.println(proCredit.toString());
        }
        return allList;
    }
}
